home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Ext
/
Gui4Cli.h
< prev
Wrap
C/C++ Source or Header
|
1999-04-21
|
19KB
|
422 lines
/*********************************************************************
**
** Gui4Cli Include file
** $VER: 3.6 (20/8/98)
** Author : D. Keletsekis - dck@hol.gr
**
** This file holds some of the Gui4Cli internal structures.
** You can access them by getting a pointer to the GCmain
** structure (see end of this file) and following the pointers
** from there.
**
** The *GCmain pointer is stored in the "gcmain" field of the
** Gui4Cli message structure, and you can get it by sending
** a GM_LOCK message to Gui4Cli, or when Gui4Cli sends you a
** message (using the CALL command).
**
** From *GCmain you can see all the gui files, the events,
** the listviews, the variables, and most of everything that
** Gui4Cli holds dear. Why you would ever want to, is an
** other matter.. Look at the C examples in this directory
** for information on how to access & manipulate them.
**
*********************************************************************/
// union used in events & commands, to hold the arguments, which
// can be numbers or strings - LTWH=numbers, Title=string etc..
union commandunion
{ LONG num; // if it's a number
char *str; // if it's a string
APTR dummy; // forget it..
};
#define OPT_COUNT 12 // max number of arguments
/*********************************************************************
The Gui4Cli message structure - use it to communicate with G4C
*********************************************************************/
struct g4cmsg
{
struct Message node; // EXEC message structure
// When Gui4Cli sends the message :
// - This will be a pointer to the command name which will
// have been converted to upper case. If there are any more
// arguments passed, then these will be stored in "args[0-5]"
// When you send a GM_COMMAND or GM_RUN message to Gui4Cli :
// - This must point to a string buffer which will contain
// the command which you want Gui4Cli to execute.
// otherwise null..
UBYTE *com;
// This will either contain a pointer to struct *GCmain, or
// NULL. You get the pointer when Gui4Cli sends you a
// message (with the CALL command), or when Gui4Cli replies
// to a GM_LOCK message that you sent. Otherwise NULL.
struct GCmain *gcmain;
// Set this to 392001 which is a "magic" number that Gui4Cli
// will recognise as being a GC type message.
LONG magic;
// 6 argument strings. When Gui4Cli sends you a message, it
// will consist of a command (which will be in *com above)
// and up to 6 arguments. This is where the arguments will
// be stored (if any) - so, if arg[x] is not NULL, it will
// contain a pointer to a null terminated string.
UBYTE *args[6];
// if you want to return something, then you must store it
// in a buffer which you MUST get using AllocVec() and point
// it here. The buffer will be available from within Gui4Cli
// as internal variable $$CALL.RET
// IMPORTANT NOTE:
// If you attach such a buffer, it will be freed by Gui4Cli,
// using FreeVec(), before Gui4Cli sends it's next message.
UBYTE *msgret;
UBYTE type; // type of message - see defines below
LONG res; // error status (0 means OK)
APTR data; // null - for future expansion
APTR exp; // null - for future expansion
};
/*********************************************************************
Message types
These are the currently available types for the "type" field
of the above structure.
*********************************************************************/
// ------------------------------------------------------------------
// A) If the command is sent by a program to Gui4Cli:
// The "com" field must point to a valid command line to be
// executed by Gui4Cli - only commands which are defined as
// "arexx capable" can be executed. The line will be translated,
// then parsed and executed. Upon returning, the "res"
// field will hold the return code, if any was set..
// ---------------------- ...
// B) If sent by Gui4Cli to an outside program, using CALL :
// "com" will point to the command name, "gcmain" will contain
// a pointer to the GCmain structure, and if there are any arguments
// they will be stored in "args[0]"-"args[5]". Upon return, $$RetCode
// will be set to the "res" value you have set (if any). 0 means OK
// ------------------------------------------------------------------
#define GM_COMMAND 1
// ------------------------------------------------------------------
// This is the same as GM_COMMAND, Part (A). The difference is that
// while GM_COMMAND will do the commands synchronously - i.e. the
// program which sends the command will have to wait until after
// Gui4Cli executes the command to receive the repply, GM_RUN will
// pass the command to Gui4Cli and return and let Gui4Cli get on
// with it asynchronously. The draw back is that you will not know
// when the command finished executing and if it was successful.
// ------------------------------------------------------------------
#define GM_RUN 2
// ------------------------------------------------------------------
// GM_LOCK will freeze Gui4Cli, until a GM_UNLOCK message is
// received. When you send a GM_LOCK message, Gui4Cli will immediately
// reply, storing a pointer to the "GCmain" structure in the message's
// "gcmain" field. It will then wait, doing nothing until a GM_UNLOCK
// message is received. Do what you want and then send GM_UNLOCK.
// ------------------------------------------------------------------
#define GM_LOCK 5
// ------------------------------------------------------------------
// MUST UNLOCK Gui4Cli after a GM_LOCK message.
// ------------------------------------------------------------------
#define GM_UNLOCK 6
/*********************************************************************
LV helper structures
these hold various things for listviews..
*********************************************************************/
// holds listview colors etc
struct styledef
{
BOOL usestyle; // =1 if styles have been specifically set
WORD fg; // foreground pen
WORD nbg; // normal background pen
WORD sbg; // selected background pen
WORD shad; // shadow - signifies to make letters 3D
};
// If a LV loads a DataBase file, it allocates a dbdef struct
// and links it to the "db" member of the fulist struct. All
// field definitions are link-listed to this struct.
struct lvfield // field definition struct (AllocVec)
{
char name[31]; // field name
LONG start; // byte in record where field starts
LONG length; // field length
UBYTE type; // field type (N)umber,(C)har or (D)ate
struct styledef sd; // full styledef struct
struct lvfield *next; // pointer to next field or null
// ----------- private fields below
};
struct dbdef
{
LONG fieldnum; // number of fields
LONG reclength; // record length
struct lvfield *topfield; // linked list of fields (AllocVec)
// ------------- private fields below
};
/*********************************************************************
LISTVIEW LINE
Every line of a listview has a structure like this.
They are kept in a struct List and given to the LV.
There is a pointer to this list in struct "fulist".
The LV shows the text pointed to by node->ln_Name.
This is set to point to some part of the *start buffer,
according to how much the list is shifted (left/right)
**********************************************************************/
struct lister
{
struct Node node; // a normal exec node for struct List. The ln_Name
// field points to the start of the visible text.
UBYTE *start; // pointer to the start of the line's text - i.e. the full buffer
LONG length; // line length - buffer is AllocMem (length+1) !!!!
BOOL Selected; // 1 = line is selected, 0 = it's not
struct fulist *fls; // ptr back to parent fulist structure (for hook)
UBYTE filend; // pointer to end of filename - for dir listviews
UBYTE type; // type of entry - F=file, D=d